package com.bw.home.model

import com.blankj.utilcode.util.NetworkUtils
import com.bw.common.entity.BaseRes
import com.bw.common.entity.NoticeEntityItem
import com.bw.home.api.HomeApiServer
import javax.inject.Inject

/**
 * 首页仓库层
 */
class HomeRepository @Inject constructor(private val apiServer:HomeApiServer) {

    suspend fun loadNoticeData(page: Int, size: Int): BaseRes<List<NoticeEntityItem>> {
        return if (NetworkUtils.isAvailable()){
            apiServer.getAnnouncements(page, size)
        }else{
            BaseRes(400,emptyList(),"当前没有网络！")
        }
    }


}